home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
amok_lha
/
amok82.lha
/
Mini
/
txt
/
Code.mod
next >
Wrap
Text File
|
1993-08-15
|
3KB
|
79 lines
MODULE Code;
IMPORT io;
VAR labels: INTEGER;
PROCEDURE W (s: ARRAY OF CHAR); BEGIN io.WriteString(s) END W;
PROCEDURE WL(s: ARRAY OF CHAR); BEGIN W(s); io.WriteLn END WL;
PROCEDURE DCL*(var: ARRAY OF CHAR); (* Speicher für var reservieren *)
BEGIN W(var); WL(": dc.l 0") END DCL;
PROCEDURE MOVEvarD0*(var: ARRAY OF CHAR); (* var nach D0 kopieren *)
BEGIN W(" MOVE.L "); W(var); WL(",D0") END MOVEvarD0;
PROCEDURE MOVEconstD0*(c: LONGINT); (* Konstante c nach D0 laden *)
BEGIN W(" MOVE.L #"); io.WriteInt(c,0); WL(",D0") END MOVEconstD0;
PROCEDURE MOVED0var*(name: ARRAY OF CHAR); (* D0 in D0 kopieren *)
BEGIN W(" MOVE.L D0,"); WL(name) END MOVED0var;
PROCEDURE MOVED0D1*; BEGIN WL(" MOVE.L D0,D1") END MOVED0D1;
PROCEDURE ADDD1D0 *; BEGIN WL(" ADD.L D1,D0") END ADDD1D0;
PROCEDURE NEGD0 *; BEGIN WL(" NEG.L D0" ) END NEGD0;
PROCEDURE TSTD0 *; BEGIN WL(" TST.L D0" ) END TSTD0;
PROCEDURE GetLabel*(): INTEGER; (* neues Label anfordern *)
BEGIN INC(labels); RETURN labels END GetLabel;
PROCEDURE Label*(l: INTEGER); (* Label <l> ausgeben *)
BEGIN W("L"); io.WriteHex(l,3); WL(":") END Label;
PROCEDURE BLE*(l: INTEGER); (* BLE <l> erzeugen *)
BEGIN W(" BLE L"); io.WriteHex(l,3); WL("") END BLE;
PROCEDURE BRA*(l: INTEGER); (* BRA <l> erzeugen *)
BEGIN W(" BRA L"); io.WriteHex(l,3); WL("") END BRA;
PROCEDURE PrintD0*; (* Wert von D0 ausgeben *)
BEGIN
WL(" LEA _format,A0");
WL(" MOVE.L A0,D1" );
WL(" LEA _print,A0" );
WL(" MOVE.L A0,D2" );
WL(" MOVE.L D0,(A0)" );
WL(" MOVE.L _dos,A6" );
WL(" JSR -954(A6)" );
END PrintD0;
PROCEDURE StartUp*(start: INTEGER); (* Dos-Library öffnen, etc. *)
BEGIN
WL("_dos: DC.L 0" );
WL("_dosname: DC.B 'dos.library',0");
WL("_format: DC.B '%ld',10,0" );
WL(" DS.L 0" );
WL("_print: DC.L 0" );
Label(start);
WL(" LEA _dosname,A1" );
WL(" MOVE.L #37,D0" );
WL(" MOVE.L $4,A6" );
WL(" JSR -552(A6)" );
WL(" TST.L D0" );
WL(" BNE.S _ok" );
WL(" RTS" );
WL("_ok:" );
WL(" MOVE.L D0,_dos" );
END StartUp;
PROCEDURE CleanUp*; (* Dos-Library schließen, etc. *)
BEGIN
WL(" MOVE.L _dos,A1" );
WL(" MOVE.L $4,A6" );
WL(" JSR -414(A6)");
WL(" MOVE.L #0,D0" );
WL(" RTS" );
WL(" END" );
END CleanUp;
BEGIN labels := 0 END Code.